package com.yc.sole.system.request;

import com.yc.sole.common.enums.TrueOrFalse;
import com.yc.sole.framework.validate.SaveGroup;
import com.yc.sole.framework.validate.UpdateGroup;
import com.yc.sole.system.enums.SequencePrefixRule;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import java.io.Serializable;

/**
 * Request对象
 *
 * @author yizuomin
 * @date 2024-03-06
 **/
@Data
public class SequenceRuleReq implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     *
     */
    @NotNull(groups = {UpdateGroup.class})
    private Long id;
    /**
     * 序列编码
     */
    @Length(max = 50, groups = {SaveGroup.class, UpdateGroup.class})
    @NotBlank(groups = {SaveGroup.class, UpdateGroup.class})
    private String sequenceCode;
    /**
     * 序列名称
     */
    @Length(max = 50, groups = {SaveGroup.class, UpdateGroup.class})
    @NotBlank(groups = {SaveGroup.class, UpdateGroup.class})
    private String sequenceName;
    /**
     * 序列长度
     */
    @Max(value = 32, groups = {SaveGroup.class, UpdateGroup.class})
    @NotNull(groups = {SaveGroup.class, UpdateGroup.class})
    private Integer length;
    /**
     * 长度不够是否自动在左边填充0
     */
    @NotNull(groups = {SaveGroup.class, UpdateGroup.class})
    private TrueOrFalse autoFill;
    /**
     * 前缀规则
     */
    @NotNull(groups = {SaveGroup.class, UpdateGroup.class})
    private SequencePrefixRule prefixRule;
    /**
     * 前缀
     */
    @Length(max = 10, groups = {SaveGroup.class, UpdateGroup.class})
    private String prefix;
}
